﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CuaHangLaptop.DAL;

namespace CuaHangLaptop.BIZ
{
    public class KhachHang_BIZ
    {
        int id;
        string maKH;
        string tenKH;
        string sdt;
        string email;
        string diachi;
        string username;
        string pass;

        public int ID
        {
            get { return id; }
            set { id = value; }
        }

        public string MaKH
        {
            get { return maKH; }
            set { maKH = value; }
        }

        public string TenKH
        {
            get { return tenKH; }
            set { tenKH = value; }
        }

        public string Sdt
        {
            get { return sdt; }
            set { sdt = value; }
        }

        public string Email
        {
            get { return email; }
            set { email = value; }
        }

        public string Diachi
        {
            get { return diachi; }
            set { diachi = value; }
        }

        public string Username
        {
            get { return username; }
            set { username = value; }
        }

        public string Pass
        {
            get { return pass; }
            set { pass = value; }
        }

        public KhachHang_BIZ()
        {
        }

        public KhachHang_BIZ(int _id, string _makh, string _tenkh, string _sdt, string _email, string _diachi, string _username, string _pass)
        {
            id = _id;
            maKH = _makh;
            tenKH = _tenkh;
            sdt = _sdt;
            email = _email;
            diachi = _diachi;
            username = _username;
            pass = _pass;
        }

        public KhachHang_BIZ Get_KH_ByCode(string _makh)
        {
            return KhachHang_DAL.Get_KhachHang_ByCode(_makh);
        }

        public List<KhachHang_BIZ> GetAll_KH()
        {
            return KhachHang_DAL.GetAll_KH();
        }

        public void Save()
        {
            if (id == -1) id = KhachHang_DAL.Insert(this);
            else KhachHang_DAL.Update(this);
        }

        public void Delete()
        {
            KhachHang_DAL.Delete(this);
        }

        public int Get_Lasted_ID()
        {
            return KhachHang_DAL.Get_Lasted_ID();
        }
    }
}
